#pragma once

#include <QObject>
#include <QTcpSocket>
#include <QFile>
#include <QElapsedTimer>
#include "CzCommon.h"

class CzTcpclient  : public QObject
{
	Q_OBJECT

public:
	CzTcpclient(QObject *parent = nullptr);
	~CzTcpclient();
	void sendFile(const QString &filePath);
	void Conn(QString, quint16);
	void DisConn();

private:
	QTcpSocket *socket;
	QString filePath;

	QElapsedTimer sendTimer;
	qint64 lastSentBytes;
	qint64 lastSentTime;

	QString FormatSpeed(double bytesPerSecond);
};
